import request from '@/utils/request'

/* *
 * 获取参数列表
 */
export const getGoodsParamsList = (id, sel) =>
  request({
    url: `categories/${id}/attributes`,
    params: {
      sel
    }
  })

/* *
 * 添加动态参数或者静态属性
 */
export const addParams = (id, data) =>
  request({
    method: 'POST',
    url: `categories/${id}/attributes`,
    data
  })

/* *
 * 根据 ID 查询参数
 */
export const getParamsById = (id, attrId, params) =>
  request({
    url: `categories/${id}/attributes/${attrId}`,
    params
  })

/* *
 * 编辑提交参数
 */
export const editParams = (id, attrId, data) =>
  request({
    method: 'PUT',
    url: `categories/${id}/attributes/${attrId}`,
    data
  })

/* *
 * 删除参数
 */
export const deleteParamsById = (id, attrId) =>
  request({
    method: 'DELETE',
    url: `categories/${id}/attributes/${attrId}`
  })
